﻿<template>

    <div class="sudoku" id="app2">

        <div class="sudoku_row" style="background-color:#ffffff">
            <div class="sudoku_item " v-for="sudoku in tabs"  @click="touchend">
                <img :src="sudoku.imgurl" width="40" height="40">
                {{sudoku.name}}
            </div>
        </div>
    </div>



</template>

<script>
    import Bus from '../bus.js'
    export default {
        data() {
            return {
                sudokus: this.sudokus
            }
        },
        props: {
            tabs: Array,
        },
        methods: {
            touchend: function (e) {
                var html = e.currentTarget.innerHTML;
                var usertype = window.localStorage.getItem("usertype");
                html = html.replace(/<\/?.+?>/g, "");
                html = html.replace(/(^\s*)|(\s*$)/g, ""); 
               

                if (html == "签到") {
                    if (usertype == "1") {
                        Bus.$emit('val', "hide")
                        this.$router.push('/mysignlist');
                    } else if (usertype == "2") {

                        Bus.$emit('tab', "3")
                    }
                 
                 
                } else if (html == "视频") {
                    Bus.$emit('tab', "2")
                  
                } else if (html == "食谱") {

                    Bus.$emit('val', "hide")
                    this.$router.push('/foodlist');
                   
                   
                } else if (html == "消息") {
                    Bus.$emit('tab', "4")
                 //   this.$router.push('/message');

                } else if (html == "风采") {
                    Bus.$emit('val', "hide")
                 
                    this.$router.push('/news');
                   

                } else if (html == "请假") {
                    Bus.$emit('val', "hide");
                    this.$router.push('/leavelist');
                  

                } else if (html == "作业") {
                    Bus.$emit('val', "hide")
                    this.$router.push('/work');

                } else if (html == "设置") {
                    Bus.$emit('val', "hide")
                   this.$router.push('/setting');

                }
            }
        }
    }

</script>

<style scoped>
    * {
        margin: 0px;
        padding: 0px;
    }

    .sudoku_row {
        display: flex;
        align-items: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .sudoku_item {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        width: 25%;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .opacity {
        opacity: 0.4;
        background: #e5e5e5;
    }

    .sudoku_item img {
        margin-bottom: 3px;
        display: block;
    }
</style>